package com.caikun.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.caikun.services.MsgService;



/**
 * Servlet implementation class SendMarkController
 */
public class SendMarkController extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private MsgService ms =new MsgService();
	
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		response.setHeader("Access-Control-Allow-Origin","*");
		String tel =request.getParameter("bind");
		System.out.println(tel);
		//返回
		PrintWriter out =response.getWriter();
		
//		ms.sendMessage(tel);
		out.write("{\"success\":\""+ms.sendMessage(tel)+"\"}");
		out.flush();
		out.close();
	}
}
